﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gueei.Gallery.Core.Entities;
using Gueei.Gallery.Core.Repositories;

namespace Gueei.Gallery.Core.Services
{
	public class AlbumService
	{
		public IAlbumRepository AlbumRepo { get; private set; }

		public AlbumService(IAlbumRepository albumRepo)
		{
			AlbumRepo = albumRepo;
		}

		public Album CreateAlbum(string name, IList<Image> images, IList<Tag> tags)
		{
			Album newAlbum = AlbumRepo.CreateAlbum(name, new HashSet<Image>(images), new HashSet<Tag>(tags));
			newAlbum.CoverImage = images.FirstOrDefault();
			AlbumRepo.SaveAlbum(newAlbum);
			return newAlbum;
		}
	}
}
